/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sigec_ead.controle;

import java.sql.Connection;
import java.sql.SQLException;
import org.postgresql.jdbc3.Jdbc3PoolingDataSource;
/**
 *
 * @author Joeldson
 */
public class ConexaoJDBC {

    private static Jdbc3PoolingDataSource dataSource;

    public static Connection getConexao() throws SQLException{

        if(dataSource!=null){
            return dataSource.getConnection();
            
        }

        dataSource = new Jdbc3PoolingDataSource();
        dataSource.setServerName("localhost");
        dataSource.setPortNumber(5432);
        dataSource.setDatabaseName("sigec");
        dataSource.setUser("postgres");
        dataSource.setPassword("senha");
        
        return dataSource.getConnection();
    }
}
 